rx: Receiver<Message<'a>>,
active: usize,
pending: HashMap<Key<'a>, PendingBuild>,
- printed: HashSet<&'a PackageId>,
+ compiled: HashSet<&'a PackageId>,
+ documented: HashSet<&'a PackageId>,
counts: HashMap<&'a PackageId, usize>,
}
rx: rx,
active: 0,
pending: HashMap::new(),
- printed: HashSet::new(),
+ compiled: HashSet::new(),
+ documented: HashSet::new(),
counts: HashMap::new(),
}
}
});
// Print out some nice progress information
- try!(self.note_working_on(config, key.pkg, fresh));
+ try!(self.note_working_on(config, &key, fresh));
// only the first message of each job is processed
if let Ok(msg) = desc_rx.recv() {
// In general, we try to print "Compiling" for the first nontrivial task
// run for a package, regardless of when that is. We then don't print
// out any more information for a package after we've printed it once.
- fn note_working_on(&mut self, config: &Config, pkg: &'a PackageId,
+ fn note_working_on(&mut self, config: &Config, key: &Key<'a>,
fresh: Freshness) -> CargoResult<()> {
- if self.printed.contains(&pkg) {
+ if (self.compiled.contains(key.pkg) && !key.profile.doc) ||
+ (self.documented.contains(key.pkg) && key.profile.doc) {
return Ok(())
}
// Any dirty stage which runs at least one command gets printed as
// being a compiled package
Dirty => {
- self.printed.insert(pkg);
- try!(config.shell().status("Compiling", pkg));
+ if key.profile.doc {
+ self.documented.insert(key.pkg);
+ try!(config.shell().status("Documenting", key.pkg));
+ } else {
+ self.compiled.insert(key.pkg);
+ try!(config.shell().status("Compiling", key.pkg));
+ }
}
- Fresh if self.counts[pkg] == 0 => {
- self.printed.insert(pkg);
- try!(config.shell().verbose(|c| c.status("Fresh", pkg)));
+ Fresh if self.counts[key.pkg] == 0 => {
+ self.compiled.insert(key.pkg);
+ try!(config.shell().verbose(|c| c.status("Fresh", key.pkg)));
}
Fresh => {}
}
pub static RUNNING: &'static str = " Running";
pub static COMPILING: &'static str = " Compiling";
+pub static DOCUMENTING: &'static str = " Documenting";
pub static FRESH: &'static str = " Fresh";
pub static UPDATING: &'static str = " Updating";
pub static ADDING: &'static str = " Adding";
use std::io::prelude::*;
use support::{project, execs};
-use support::{COMPILING, RUNNING, DOCTEST, FRESH};
+use support::{COMPILING, RUNNING, DOCTEST, FRESH, DOCUMENTING};
use support::paths::CargoPathExt;
use hamcrest::{assert_that};
assert_that(p.cargo("doc").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.5.0 (file://[..])
+{documenting} foo v0.5.0 (file://[..])
{running} `rustdoc [..]`
-", compiling = COMPILING, running = RUNNING)));
+", documenting = DOCUMENTING, running = RUNNING)));
File::create(&p.root().join("src/main.rs")).unwrap()
.write_all(b"fn main() {}").unwrap();
assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
execs().with_status(0)
- .with_stdout(&format!("\
-{compiling} d1 v0.0.0 ({url})
-{running} `rustc d1[..]build.rs [..] --out-dir {dir}[..]target[..]build[..]d1-[..]`
-{running} `{dir}[..]target[..]build[..]d1-[..]build-script-build`
-{running} `{dir}[..]target[..]build[..]d1-[..]build-script-build`
-{running} `rustc d1[..]src[..]lib.rs [..]`
-{running} `rustc d1[..]src[..]lib.rs [..]`
-{compiling} d2 v0.0.0 ({url})
+ .with_stdout_contains(&format!("\
+{compiling} d1 v0.0.0 ({url})", compiling = COMPILING, url = p.url()))
+ .with_stdout_contains(&format!("\
+{running} `rustc d1[..]build.rs [..] --out-dir {dir}[..]target[..]build[..]d1-[..]`",
+ running = RUNNING, dir = p.root().display()))
+ .with_stdout_contains(&format!("\
+{running} `{dir}[..]target[..]build[..]d1-[..]build-script-build`", running = RUNNING,
+ dir = p.root().display()))
+ .with_stdout_contains(&format!("\
+{running} `rustc d1[..]src[..]lib.rs [..]`", running = RUNNING))
+ .with_stdout_contains(&format!("\
+{compiling} d2 v0.0.0 ({url})", compiling = COMPILING, url = p.url()))
+ .with_stdout_contains(&format!("\
{running} `rustc d2[..]src[..]lib.rs [..] \
- -L /path/to/{host}`
-{compiling} foo v0.0.0 ({url})
+ -L /path/to/{host}`", running = RUNNING, host = host))
+ .with_stdout_contains(&format!("\
+{compiling} foo v0.0.0 ({url})", compiling = COMPILING, url = p.url()))
+ .with_stdout_contains(&format!("\
{running} `rustc build.rs [..] --out-dir {dir}[..]target[..]build[..]foo-[..] \
- -L /path/to/{host}`
-{running} `{dir}[..]target[..]build[..]foo-[..]build-script-build`
+ -L /path/to/{host}`", running = RUNNING, dir = p.root().display(), host = host))
+ .with_stdout_contains(&format!("\
{running} `rustc src[..]main.rs [..] --target {target} [..] \
- -L /path/to/{target}`
-", compiling = COMPILING, running = RUNNING, target = target, host = host,
- url = p.url(),
- dir = p.root().display())));
+ -L /path/to/{target}`", running = RUNNING, target = target)));
});
test!(build_deps_for_the_right_arch {
use std::str;
use support::{project, execs, path2url};
-use support::{COMPILING, RUNNING};
+use support::{COMPILING, DOCUMENTING, RUNNING};
use hamcrest::{assert_that, existing_file, existing_dir, is_not};
fn setup() {
assert_that(p.cargo_process("doc"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
+[..] foo v0.0.1 ({dir})
+[..] foo v0.0.1 ({dir})
",
- compiling = COMPILING,
dir = path2url(p.root()))));
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
assert_that(p.cargo_process("doc"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} foo v0.0.1 ({dir})
+{documenting} foo v0.0.1 ({dir})
",
- compiling = COMPILING,
+ documenting = DOCUMENTING,
dir = path2url(p.root()))));
assert_that(p.cargo("doc"),
assert_that(p.cargo_process("doc"),
execs().with_status(0).with_stdout(&format!("\
-{compiling} bar v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir})
+[..] bar v0.0.1 ({dir})
+[..] bar v0.0.1 ({dir})
+{documenting} foo v0.0.1 ({dir})
",
- compiling = COMPILING,
+ documenting = DOCUMENTING,
dir = path2url(p.root()))));
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(p.cargo_process("doc").arg("--no-deps"),
execs().with_status(0).with_stdout(&format!("\
{compiling} bar v0.0.1 ({dir})
-{compiling} foo v0.0.1 ({dir})
+{documenting} foo v0.0.1 ({dir})
",
- compiling = COMPILING,
+ documenting = DOCUMENTING, compiling = COMPILING,
dir = path2url(p.root()))));
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(p.cargo_process("doc").arg("-p").arg("a"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} b v0.0.1 (file://[..])
-{compiling} a v0.0.1 (file://[..])
-", compiling = COMPILING)));
+[..] b v0.0.1 (file://[..])
+[..] b v0.0.1 (file://[..])
+{documenting} a v0.0.1 (file://[..])
+", documenting = DOCUMENTING)));
});
test!(doc_same_name {
assert_that(p.cargo("doc").arg("--release").arg("-v"),
execs().with_status(0)
.with_stdout(&format!("\
-{compiling} foo v0.0.1 ([..])
+{documenting} foo v0.0.1 ([..])
{running} `rustdoc src[..]lib.rs [..]`
-", compiling = COMPILING, running = RUNNING)));
+", documenting = DOCUMENTING, running = RUNNING)));
});
test!(doc_multiple_deps {